package org.wrigut.parser;

import org.wrigut.scanlib.*;

/* ParseTree.java
 * 
 * Project 1 - CS 3361
 * 
 * Authors: Chris Gutierrez
 *          Jordan Wright
 */

public class ParseTree {
	private Object[] tree;
	private String root;
	
	public ParseTree(String rootName, int size) {
		tree = new Object[size];
		root = rootName;
	}
	
	public ParseTree(String rootName) {
		tree = null;
		root = rootName;
	}
	
	public void setBranch(int index, ParseTree subtree) {
		tree[index] = subtree;
	}
	
	public void setLeaf(int index, Token leaf) {
		tree[index] = leaf;
	}
	
	public Object getBranch(int index) {
		return tree[index];
	}
	
	public int getSize() {
		if (tree == null)
			return 0;
		else
			return tree.length;
	}
	
	public String toString() {
		return root;
	}
}
